Skip to main content

Pods DNS - Configs and Policies

In Kubernetes, the Container Network Interface (CNI) plugin connects pods. A Linux network namespace is an isolated view of interfaces and routes managed by the operating-system kernel; traffic between nearby pods can stay on the same machine.

Kubernetes configures Domain Name System (DNS) for pods through /etc/resolv.conf, which lists DNS servers and search suffixes. A DNS policy selects the default setup or lets a pod provide its own nameservers and options. In this post - we are going to compare the impacts of DNS Policies and Configs on Pod deployments.

DNSPolicy: None​

Use None only with an explicit DNS configuration. It disables the automatic cluster DNS settings, so the pod must provide working nameservers itself.

With this config - the Pods /etc/resolv.conf will have at least 1 nameserver configured in spec.dnsConfig.nameservers

DNSPolicy: Default​

Default copies the node’s DNS settings into the pod.

DNSPolicy: ClusterFirst​

ClusterFirst tries Kubernetes Service names through cluster DNS before falling back to external lookup.

Share: